package com.adnaan.restaurant.service.impl;

import com.adnaan.restaurant.entity.ResShoppingCart;
import com.adnaan.restaurant.mapper.ResShoppingCartMapper;
import com.adnaan.restaurant.service.IResShoppingCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author: adnaan
 * create: 2023-12-09 17:35
 * Description:
 */
@Service
public class ResShoppingCartServiceImpl implements IResShoppingCartService {

    @Autowired
    private ResShoppingCartMapper resShoppingCartMapper;

    @Override
    public ResShoppingCart selectShoppingCartByDishesId(Long userId, Long dishesId) {
        return resShoppingCartMapper.selectShoppingCartByDishesId(userId, dishesId);
    }

    @Override
    public int updateShoppingCartNum(Long id, Integer newQuantity) {
        return resShoppingCartMapper.updateShoppingCartNum(id, newQuantity);
    }

    @Override
    public int insertShoppingCart(ResShoppingCart resShoppingCart) {
        return resShoppingCartMapper.insertShoppingCart(resShoppingCart);
    }

    @Override
    public List<ResShoppingCart> findAll(Long userId, Long shopId) {
        return resShoppingCartMapper.findAll(userId, shopId);
    }

    @Override
    public int delCartDishes(Long id) {
        return resShoppingCartMapper.delCartDishes(id);
    }

    @Override
    public int clearCart(Long userId, Long shopId) {
        return resShoppingCartMapper.clearCart(userId, shopId);
    }

    @Override
    public int updateNum(Long id, Integer newQuantity) {
        return resShoppingCartMapper.updateNum(id, newQuantity);
    }
}
